﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ConfigArea.ascx.cs"
    Inherits="LGSVR_WEB.terminal.ConfigArea" %>
<script type="text/javascript">
    $(function () {
        function createAreaTr(len) {
            var hasLen = $("#tbArea tr").length;
            var str;
            if (hasLen < len) {
                for (var i = 0; i < len - hasLen; i++) {
                    str = "<tr><td>" + parseInt($("#tbArea tr").length + 1) + ".&nbsp;&nbsp;";
                    str += "&nbsp;&nbsp;X: <input type='text' style='width: 40px' name='txtAreaBeginX' />";
                    str += "&nbsp;&nbsp; Y：<input type='text' style='width: 40px' name='txtAreaBeginY' />";
                    str += "&nbsp;&nbsp;宽度：<input type='text' style='width: 40px' name='txtAreaWidth' />";
                    str += "&nbsp;&nbsp;高度：<input type='text' style='width: 40px' name='txtAreaHeight' /></td></tr>";
                    $("#tbArea").append(str);
                }
            }
            else {
                if (confirm('所选的分区减少后，多出的分区及亮度将减少，确认删除？')) {
                    for (var i = hasLen - 1; i > len - 1; i--) {
                        $("#tbArea tr").eq(i).remove();
                        //$("#tbArea tr").eq(i).find("input[type='text']").attr("disabled", "disabled");
                    }
                }
            }
        }
        $("#<%=dropActCount.ClientID %>").change(function () {
            var len = $(this).val();
            createAreaTr(len);
            createLightTr(len);
        });
        $("#<%=dropActCount.ClientID %>").val("8");
        createAreaTr(8);
        createLightTr(8);
    });
</script>

    有效分区个数：
    <asp:DropDownList runat="server" ID="dropActCount">
    </asp:DropDownList>

<table class="edittb" cellpadding="0" cellspacing="0" id="tbArea">

</table>
<div class="btnEdit">
    <asp:Button ID="btnSave" runat="server" Text="添 加" OnClick="btnSave_Click" />
    <asp:Button ID="btnBack" runat="server" Text="返 回" />
</div>